Getting and Setting an Ink Object's Color
You can use theGXGetInkColor
function to retrieve the color (as agxColor
structure) of an existing ink object; you can use theGXGetShapeColor
function to retrieve the color of the ink object associated with a particular shape. You can use
theGXSetInkColor
function to assign a color to an ink; you can use theGXSetShapeColor
function to assign a color to the ink object associated with a particular shape.To simply get the color of an existing ink (referenced here by
myInk
) requires defining a color structure, then calling the GXGetInkColor function to fill it:
gxColor myInkColor; GXGetInkColor(myInk, &myInkColor);If you want to obtain some part of the ink's color structure, such as its color space, you could make calls like this:
gxColorSpace myInkSpace; gxColor myInkColor; myInkSpace = GXGetInkColor(myInk, &myInkColor)->space;Conversely, to assign some portion of an ink's color structure, such as its color profile (here callednewProfile
), you could make these calls:
gxColor myInkColor; GXGetInkColor(myInk, &myInkColor); myInkColor.profile = newProfile; GXSetInkColor(myInk, &myInkColor);You can give a shape a specific color by setting the individual values of its ink's color components. For a shape (myShape
) whose ink uses an RGB color space, you could do something like this (with numeric color valuesnewRed
,newBlue
, andnewGreen
):
gxColor newColor; newColor.space = gxRGBSpace; newColor.profile = nil; newColor.element.rgb.red = newRed; newColor.element.rgb.green = newGreen; newColor.element.rgb.blue = newBlue; GXSetShapeColor(myShape, &newColor);TheGXGetInkColor
function is described on page 5-68; theGXGetShapeColor
function is described on page 5-70. TheGXSetInkColor
function is described on page 5-69; theGXSetShapeColor
function is described on page 5-71.Colors and how to program with them are not described further in this chapter; for complete information, see the chapter "Colors and Color-Related Objects" in this book.